
import java.util.Scanner;
import java.util.Set;
import java.util.TreeSet;

public class Main2 {
	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		Set<String> str = new TreeSet<String>();
		int n = 10;
		while (scanner.hasNext()) {
			String string = scanner.next();
			if (string.equals("!!!!!")) {
				break;
			} else if (!str.contains(string)) {
					str.add(string);
				}
			}
			System.out.println(str.size());
			str.toArray();
			if (str.size() <= 10) {
				for (String string2 : str) {
					System.out.println(string2);
				}
			} else {
				for (String string2 : str) {
					if (n-- <= 0)
						break;
					System.out.println(string2);
				}
			}
			scanner.close();
		}
	}